#ifndef __MCS__FUNCTION_FACTORY__HPP
#define __MCS__FUNCTION_FACTORY__HPP

#include "Function.hpp"
#include "FunctionSignature.hpp"

class FunctionFactory : public Object
{
public:
	FunctionFactory() : Object() {}
	~FunctionFactory() {}

	void loadBuiltIns();

	ptr<Function> getFunction(FunctionSignature const & signature) const;
private:
	typedef std::map<FunctionSignature, ptr<Function> > FunctionsDatabase;
	FunctionsDatabase database_;

	void insertFunction(ptr<Function> const & func);
	template<class T> void insertFunction(String const & name, T pFunc);
};

#endif //__MCS__FUNCTION_FACTORY__HPP
